package top.jiangqiang.seataservice1;

import org.springframework.data.jdbc.repository.query.Modifying;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

public interface StockRepository extends CrudRepository<Stock, Long> {
    @Modifying
    @Query("UPDATE stock SET count = count - 1 WHERE id = :id")
    int decreaseStockCount(@Param("id") long id);
}